Promise Resolve Timeout
Create a Promise which will resolve with the provided value after a timeout.
Install
npm install --save promise-resolve-timeout
Usage
If the passed value is a function it will be called and its return value will be the resolved value, otherwise the passed value is the resolved value.
import resolveTimeout from 'promise-resolve-timeout';
Promise.race ([
resolveTimeout ( 1000, false ),
resolveTimeout ( 5000, () => 'foo' ),
new Promise ( () => {
});
]);
resolveTimeout ( 1000 )
.then ( () => {
});
License
MIT © Fabio Spampinato